//
//  CampusConfigModel.m
//  ShowYork
//
//  Created by hxh on 2021/3/31.
//  Copyright © 2021 hxh. All rights reserved.
//

#import "CampusConfigModel.h"
#import "CampusParamItemModel.h"
@implementation CampusConfigModel
MJCodingImplementation
+(NSDictionary *)mj_objectClassInArray{
    return @{@"paramList":[CampusParamItemModel class],
    };
}
- (void)saveWithKey:(NSString *)key{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self];
    [defaults setObject:data forKey:key];
    [defaults synchronize];
}
+ (CampusConfigModel *)getWithKey:(NSString *)key{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSData *data = [defaults objectForKey:key];
    CampusConfigModel *model = [NSKeyedUnarchiver unarchiveObjectWithData:data];
    [defaults synchronize];
    return model;
}

/*
 - (void)save{
     NSMutableData *data = [NSMutableData data];
     //创建归档对象
     NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc]initForWritingWithMutableData:data];
     //开始归档
     [archiver encodeObject:self forKey:@"CLUserInfo"];
     //完成归档
     [archiver finishEncoding];
     //写入文件当中
     
     BOOL result = [data writeToFile:RPArchiverPath atomically:YES];
     if (result) {
         NSLog(@"归档成功:%@",RPArchiverPath);
     }else
     {
         NSLog(@"归档不成功!!!");
     }
 }
 +(UserInfoModel *)userInfo{
     //准备解档路径
     NSData *myData = [NSData dataWithContentsOfFile:RPArchiverPath];
     //创建反归档对象
     NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:myData];
     //反归档
     UserInfoModel *userInfo = [UserInfoModel new];
     userInfo = [unarchiver decodeObjectForKey:@"CLUserInfo"];
     //完成反归档
     [unarchiver finishDecoding];
     
     return userInfo;
 }

 */
@end
